/**
 * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.babble.user.service;

import com.babble.user.dto.UserOrToUserDTO;
import com.babble.user.entity.User;
import com.babble.user.entity.UserInfo;
import com.babble.user.entity.UserOauth;
import com.babble.user.vo.UserUpdVO;
import com.babble.user.vo.UserVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.common.exception.MsgException;

/**
 * 用户表 服务类
 *
 * @author Blade
 * @since 2021-11-07
 */
public interface IUserService extends IService<User> {

	/**
	 * 自定义分页
	 *
	 * @param page
	 * @param user
	 * @return
	 */
	IPage<UserVO> selectUserPage(IPage<UserVO> page, UserVO user);

	/**
	 * 用户信息
	 *
	 * @param userId
	 * @return
	 */
	UserInfo userInfo(String userId);

	/**
	 * 用户信息
	 *
	 * @param username
	 * @param password
	 * @return
	 */
	UserInfo userInfo(String username, String password);

	/**
	 * 用户信息
	 *
	 * @param userOauth
	 * @return
	 */
	UserInfo userInfo(UserOauth userOauth);

	/**
	 * 评论模块获取评论人和被评论人的用户名和头像
	 *
	 * @param userId   评论人id
	 * @param toUserId 被评论人id
	 * @return
	 */
	UserOrToUserDTO userInfoOrToUserinfo(String userId, String toUserId);

	/**
	 * 用户注册
	 *
	 * @param user 用户信息
	 * @throws MsgException
	 */
	void registered(User user) throws MsgException;
	/**
	 * 判断邮箱是否重复
	 *
	 * @param email 邮箱
	 * @return
	 */
	void isEmail(String email) throws MsgException;
	/**
	 * 邮箱认证
	 *
	 * @param userId 用户id
	 */
	void maillV(Long userId);
	/**
	 * 修改用户信息
	 *
	 * @param user 用户信息
	 * @return
	 */
	User userUpd(User user);
	/**
	 * 修改邮箱
	 *
	 * @param email 邮箱
	 * @throws MsgException
	 */
	void update(String email) throws MsgException;
	/**
	 * 判断用户是否需要认证
	 *
	 * @throws MsgException
	 */
    void isBind() throws MsgException;
	/**
	 * gitee绑定账户密码
	 *
	 * @param userName 账户
	 * @param password 密码
	 * @throws MsgException
	 */
	void bind(String userName, String password) throws MsgException;
	/**
	 * 修改用户信息
	 *
	 * @param user 用户修改userUpdVO数据
	 * @throws MsgException
	 */
	void updteInfo(UserUpdVO user) throws MsgException;
	/**
	 * 修改密码
	 *
	 * @param oldPassword 老密码
	 * @param newPassword 新密码
	 * @throws MsgException
	 */
    void updatePwd(String oldPassword, String newPassword) throws MsgException;
}
